[]"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t"]













import Vue from "vue"
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'
import { sync } from 'vuex-router-sync'
import * as myss from './demos/mystores.js'
import 'libs/jquery-1.11.3.min.js'
// import Echarts from 'vue-echarts'
// import ECharts from 'vue2-echarts'
import sha1 from 'js-sha1'
Vue.use(VueRouter)
// Vue.use(VueResource)
import App from './App'
import Vuex from 'vuex'
Vue.use(Vuex)
Vue.use(myss)
import vuexI18n from 'vuex-i18n'

require('es6-promise').polyfill()

/**
* you can add your module here
*/
let store = new Vuex.Store({
    modules: {
        i18n: vuexI18n.store
    }
})
var  myrest = "";
store.registerModule('vuxx', {
    state: {
        aabbccdd:334422,
        bbccssdd:344442114445556666,
        count:1,
        url:"http://116.228.152.190:666/lejf-mobile-api"
      },
    getters: {
        evenOrOddcc: state => state.count % 2 === 0  ?  'event' : 'odd'
    }
})
var environment = 'local';
var address = {
    local: {
        baseurl:"http://10.8.8.16:8080/lejf-mobile-api",
        baseapi:"http://appjk.lep365.com/api",
        //baseapi:"http://10.8.8.16:8080/lejf-mobile-api/api",
        //duodata:"http://10.8.8.38:8081/lejf-game-api/api",
        duodata:"http://xyx.lep365.com/lejf-game-api/api",
        //duopay:"http://10.8.8.13:8080/lejf-pay-api/api",
        duopay:"http://pay.lep365.com/lejf-pay-api/api",
        hgshop:"http://10.8.8.16:8080/lejf-mobile-api/hgShop/goods?accessToken=会话令牌"
    },
  public:{

  }
}
var config = {
    environment: environment,
    service:address[environment]
}
console.log(config.service.index)
store.registerModule('vux', {
    state: {
        agent:{
            'dls01':'93JD91',
            'dls02':'S3NSMS',
        },
        demoScrollTop: 0,
        isLoading: false,
        direction: 'forward',
        emulatedeal:'http://116.228.152.190:666/lejf-mobile-exchange-hq-api/api',
        tokenurl:'http://appjk.lep365.com/get-access-token?mobileType=6&mobileId=h5',
        tokeninurl:'http://10.8.8.16:8080/lejf-mobile-api/get-access-token?mobileType=6&mobileId=h5',
        directioddn: 'forwrsard',
        count:1,
        nots: [],
        requireCondition:{},
        authenticated:false,
        rest_Login:false,
        rest_QueryHome:"",
        rest_QueryKnowledgeGroup:"",
        rest_IndexProducts:"",
        rest_BuyProduct:"",
        rest_UserBuyedHistory:"",
        rest_2Login:"",
        rest_ShowWinRecord:"",
        login: {
            accessToken:'',
            actionName:'',
            payload:'',
            sign:'',
            timestamp:'',
            secretKey:''
        }
    },
    getters: {
        evenOrOdd: state => state.count % 2 === 0  ?  'event' : 'odd',
        all_nots(state){
             return state.requireCondition
             // return state.nots
        },
        all_login(state){
            return state.login
        },
        all_agent(state){
            return state.agent
        },
        all_restful(state){
       //
            return  state.rest_Login
        },
        all_restful_QueryHome(state){
            return  state.rest_QueryHome
        },
        all_restful_QueryKnowledgeGroup(state){
            return  state.rest_QueryKnowledgeGroup
        },
        all_restful_IndexProducts(state){
            return  state.rest_IndexProducts
        },
        all_restful_BuyProduct(state){
            return  state.rest_BuyProduct
        },
        all_restful_Login(state){
            return  state.rest_2Login
        },
        all_restful_UserBuyedHistory(state){
            return  state.rest_UserBuyedHistory
        },
        all_restful_ShowWinRecord(state){
            return  state.rest_ShowWinRecord
        },
    },
  mutations: {
// <<<<<<< HEAD
    restful_api (state,payload){
      state.timestamp = new Date().getTime();
      var  tm = new Date().getTime();
      var convert = JSON.stringify(payload.url)
      console.log(config.service[payload.url],888777888777)
      if (state.login.accessToken == "") {

        http.get("http://appjk.lep365.com/get-access-token?mobileType=6&mobileId=h5").then( (nots) => {
          state.login.sign =  sha1(nots.body.accessToken + payload.actionName+ JSON.stringify(payload.postData) + tm  +nots.body.secretKey )
          console.debug("here is upper",nots.body.accessToken + payload.actionName+ JSON.stringify(payload.postData) + tm  +nots.body.secretKey );
          var ii = JSON.stringify(payload.postData) // here should motiffy
          state.login.accessToken = nots.body.accessToken;
          state.login.actionName = payload.actionName;
          state.login.payload = ii;
          state.login.secretKey = nots.body.secretKey;
          state.login.timestamp = tm
          console.info(config.service[payload.url],88888);
          http.post(config.service[payload.url],state.login).then( (back)=> {
            console.log(back)
            myrest  = 'rest_'+ state.login.actionName;
            state[myrest] = back;
            if (payload.actionName == "Login"  && back.body.message =="登录成功") {
              state.rest_Login = true
              router.push('/trade')
            }
            console.log(myrest)
            console.info(back);
          })
        })
      } else {

        var  xtm = new Date().getTime();
        state.login.sign =  sha1(state.login.accessToken + payload.actionName+ JSON.stringify(payload.postData) + xtm  +state.login.secretKey )
        console.debug("here is down below ",state.login.accessToken + payload.actionName+ JSON.stringify(payload.postData) + xtm  +state.login.secretKey );
        var ii = JSON.stringify(payload.postData) // here should motiffy
        state.login.timestamp = xtm
        state.login.payload = ii;
        state.login.actionName = payload.actionName;
          http.post(config.service[payload.url],state.login).then( (back)=> {
            console.log(back)
            myrest  = 'rest_'+ state.login.actionName;
            state[myrest] = back;
            if (payload.actionName == "Login"  && back.body.message =="登录成功") {
              state.rest_Login = true
              router.push('/trade')
             }else if (payload.actionName == "QueryUserInfo" && back.body.resultCode==-3){
                router.push('/login')
             }
            console.log(myrest)
            console.info(back);
          })
// =======
//       restful_api (state,payload){{
//           state.timestamp = new Date().getTime();
//           var tm = new Date().getTime();
//           function  options() {
//               var deal='http://116.228.152.190:666/lejf-mobile-exchange-hq-api/api',
//               rest='http://10.8.8.16:8080/lejf-mobile-api/get-access-token?mobileType=6&mobileId=h5';
//           }
//
//           var convert = JSON.stringify(payload.url)
//           console.log(config.service[payload.url],888777888777)
//           if (state.login.accessToken == "") {
//               http.get("http://appjk.lep365.com/get-access-token?mobileType=6&mobileId=h5").then( (nots) => {
//                   state.login.sign =  sha1(nots.body.accessToken + payload.actionName+ JSON.stringify(payload.postData) + tm  +nots.body.secretKey )
//                   console.debug("here is upper",nots.body.accessToken + payload.actionName+ JSON.stringify(payload.postData) + tm  +nots.body.secretKey );
//                   var ii = JSON.stringify(payload.postData) // here should motiffy
//                   state.login.accessToken = nots.body.accessToken;
//                   state.login.actionName = payload.actionName;
//                   state.login.payload = ii;
//                   state.login.secretKey = nots.body.secretKey;
//                   state.login.timestamp = tm
//                   console.info(config.service[payload.url],88888);
//                   http.post(config.service[payload.url],state.login).then( (back)=> {
//                       console.log(back)
//                       myrest  = 'rest_'+ state.login.actionName;
//                       state[myrest] = back;
//                       if (payload.actionName == "Login"  && back.body.message =="登录成功") {
//                           state.rest_Login = true
//                           router.push('/trade')
//                       }
//                       console.log(myrest)
//                       console.info(back);
//                   })
//               })
//           }else{
//               var  xtm = new Date().getTime();
//               state.login.sign =  sha1(state.login.accessToken + payload.actionName+ JSON.stringify(payload.postData) + xtm  +state.login.secretKey )
//               console.debug("here is down below ",state.login.accessToken + payload.actionName+ JSON.stringify(payload.postData) + xtm  +state.login.secretKey );
//               var ii = JSON.stringify(payload.postData) // here should motiffy
//               state.login.timestamp = xtm
//               state.login.payload = ii;
//               state.login.actionName = payload.actionName;
//               http.post(config.service[payload.url],state.login).then( (back)=> {
//                   console.log(back)
//                   myrest  = 'rest_'+ state.login.actionName;
//                   state[myrest] = back;
//                   if (payload.actionName == "Login"  && back.body.message =="登录成功") {
//                       state.rest_Login = true
//                       router.push('/trade')
//                   }
//                   console.log(myrest)
//                   console.info(back);
//               })
//         }
//       },
//
//       login_accessToken (state,accessToken){
//           state.login.accessToken = accessToken;
//       },
//       login_actionName (state,actionName){
//           state.login.actionName = actionName;
//       },
//
//       login_secretKey (state,secretKey){
//           state.login.secretKey = secretKey;
//       },
//       login_sign (state,sigin){
//           state.login.sign = sigin;
//       },
//       login_timestamp (state,timestamp){
//           state.login.timestamp = timestamp;
//       },
//       get_condition (state,token){
//         state.requireCondition = token
//       },
//       add_nots(state,not) {
//         state.nots.push(not)
//       },
//       updateDemoPosition (state, payload) {
//         state.demoScrollTop = payload.top
//       },
//       updateLoadingStatus (state, payload) {
//         state.isLoading = payload.isLoading
//       },
//       updateDirection (state, payload) {
//         state.direction = payload.direction
//       },
//       increment (state) {
//          state.count = 99
//         console.log(state.count,877)
//       },
//       decrement (state) {
//          state.count--;
// >>>>>>> bed5a88563e3f1bed20f4872ef7b8572964a811c
      }
  },
  actions: {
      updateDemoPosition ({commit}, top) {
        commit({type: 'updateDemoPosition', top: top})
      },
      increment: ({ commit  }) => commit('increment'),
      decrement: ( { commit  }) => commit('decrement'),
      incrementIfOdd: ({commit,state}) =>{
          if ((state.count + 1) % 2 === 0){
            commit('increment')
          }
      }
  }
  }
})

Vue.use(vuexI18n.plugin, store)

// plugins
import { LocalePlugin, DevicePlugin, ToastPlugin, AlertPlugin, ConfirmPlugin, LoadingPlugin, WechatPlugin, AjaxPlugin, AppPlugin } from 'vux'
Vue.use(DevicePlugin)
Vue.use(ToastPlugin)
Vue.use(AlertPlugin)
Vue.use(ConfirmPlugin)
Vue.use(LoadingPlugin)
Vue.use(WechatPlugin)
Vue.use(AjaxPlugin)
Vue.use(LocalePlugin)
Vue.use(VueResource)
// Vue.use(Echarts )

// test
if (process.env.platform === 'app') {
  Vue.use(AppPlugin, store)
}

const wx = Vue.wechat
const http = Vue.http

/**
* -------------------------- 微信分享 ----------------------
* 请不要直接复制下面代码
*/

if (process.env.NODE_ENV === 'production') {
    wx.ready(() => {
        console.log('wechat ready')
        let postData = {
          "orderId":orderNo,
          "name":"knowledge",
          "catCode":"1",
          "device":"3",
          "payType":"3",
          "amount":totalPrice,
          "openid":openId,
        }
        this.$http.get('http://10.8.8.13:8080/lejf-pay-api',postData).then((data) => {
           console.log(data)
        })
        wx.onMenuShareAppMessage({
            title: 'VUX', // 分享标题
            desc: '基于 WeUI 和 Vue 的移动端 UI 组件库',
            link: 'https://vux.li?x-page=wechat_share_message',
            imgUrl: 'https://static.vux.li/logo_520.png'
        })

        wx.onMenuShareTimeline({
            title: 'VUX', // 分享标题
            desc: '基于 WeUI 和 Vue 的移动端 UI 组件库',
            link: 'https://vux.li?x-page=wechat_share_timeline',
            imgUrl: 'https://static.vux.li/logo_520.png'
        })
    })

    const permissions = JSON.stringify(['onMenuShareTimeline', 'onMenuShareAppMessage'])
    const url = document.location.href
    http.post('https://vux.li/jssdk?url=' + encodeURIComponent(url.split('#')[0]) + '&jsApiList=' + permissions).then(res => {
      wx.config(res.data.data)
    })
}

import objectAssign from 'object-assign'

const vuxLocales = require('json-loader!yaml-loader!vux/src/locales/all.yml')
const componentsLocales = require('json-loader!yaml-loader!src/locales/components.yml')
const globalLocales = require('json-loader!yaml-loader!src/locales/global_locales.yml') || {en: {}, 'zh-CN': {}}

const finalLocales = {
  'en': objectAssign(vuxLocales['en'], componentsLocales['en'], globalLocales['en']),
  'zh-CN': objectAssign(vuxLocales['zh-CN'], componentsLocales['zh-CN'], globalLocales['zh-CN'])
}

for (let i in finalLocales) {
    Vue.i18n.add(i, finalLocales[i])
}

const nowLocale = Vue.locale.get()
if (/zh/.test(nowLocale)) {
    Vue.i18n.set('zh-CN')
} else {
    Vue.i18n.set('en')
}

const FastClick = require('fastclick')
FastClick.attach(document.body)

// The following line will be replaced with by vux-loader with routes in ./demo_list.json
const routes = []
const router = new VueRouter({
  routes
})

sync(store, router)

// simple history management
const history = window.sessionStorage
history.clear()
let historyCount = history.getItem('count') * 1 || 0
history.setItem('/', 0)

router.beforeEach(function (to, from, next) {
  store.commit('updateLoadingStatus', {isLoading: true})

  const toIndex = history.getItem(to.path)
  const fromIndex = history.getItem(from.path)

  if (toIndex) {
    if (!fromIndex || parseInt(toIndex, 10) > parseInt(fromIndex, 10) || (toIndex === '0' && fromIndex === '0')) {
      store.commit('updateDirection', {direction: 'forward'})
    } else {
      store.commit('updateDirection', {direction: 'reverse'})
    }
  } else {
    ++historyCount
    history.setItem('count', historyCount)
    to.path !== '/' && history.setItem(to.path, historyCount)
    store.commit('updateDirection', {direction: 'forward'})
  }

  if (/\/http/.test(to.path)) {
    let url = to.path.split('http')[1]
    window.location.href = `http${url}`
  } else {
    next()
  }
})


router.afterEach(function (to) {
    store.commit('updateLoadingStatus', {isLoading: false})
    if (process.env.NODE_ENV === 'production') {
        ga && ga('set', 'page', to.fullPath)
        ga && ga('send', 'pageview')
    }
})

new Vue({
    store,
    router,
    myss,
    render: h => h(App)
}).$mount('#app')
window.Event = new class {
    constructor(){
        this.vue = new Vue();
    }
    fire(event,data = null){
        this.vue.$emit(event,data);
    }
    listen(event,callback){
        this.vue.$on(event,callback);
    }
}
